home *** CD-ROM | disk | FTP | other *** search
/ Steal This CD / steal_this_cd.iso / Chapter 07 - Where the Hackers Are / virc200.exe / {app} / vircdde.txt < prev    next >
Text File  |  2003-05-16  |  3KB  |  101 lines

  1. Visual IRC 2.0 DDE Interface
  2. Jesse McGrew
  3. September 8, 2002
  4.  
  5. As a client
  6. ===========
  7.  
  8. ViRC's /dde command combines the features of poking data into an item,
  9. executing a macro, and reading an item's value. It can also execute a macro
  10. and then read an item's value in the same operation.
  11.  
  12. Poking data:
  13.   /dde <service> <topic> "<item>" <data>
  14.  
  15. Executing a macro:
  16.   /dde <service> <topic> "" <macro>
  17.  
  18. Reading an item's value:
  19.   $dde(<service> <topic> "<item>")
  20.  
  21. Executing and then reading:
  22.   $dde(<service> <topic> "<item>" <macro>)
  23.  
  24. As a server
  25. ===========
  26.  
  27. ViRC provides two services with DDE: executing a single command and evaluating
  28. text.
  29.  
  30. Executing a single command
  31. --------------------------
  32.  
  33. Open a connection to the service "ViRC" and the topic "IRC_Execute". Send the
  34. command you wish to execute as a macro (XTYP_EXECUTE).
  35.  
  36. Note that the command will not be evaluated before it is run. If you want it
  37. to be evaluated, use "Eval <your command here>".
  38.  
  39. Visual Basic:
  40.   txDDE.LinkTopic = "ViRC|IRC_Execute"
  41.   txDDE.LinkMode = 2
  42.   txDDE.LinkExecute "Join #quake"
  43.  
  44. Delphi:
  45.   procedure ViRC_Execute(const x: string);
  46.   var
  47.     ddeC: TDDEClientConv;
  48.   begin
  49.     ddeC := TDDEClientConv.Create(nil);
  50.     if (ddeC.SetLink('VIRC', 'IRC_Execute')) then
  51.        ddeC.ExecuteMacro(PChar(x), False);
  52.     ddeC.Free;
  53.   end;
  54.  
  55. For compatibility with other IRC clients, you can also send a command
  56. via XTYP_POKE, using the topic name "command" and the item name
  57. "IRC_Command". In this case, the command will be evaluated before being
  58. executed. It may also contain line breaks to execute more than one command.
  59.  
  60. Delphi:
  61.   procedure ViRC_ExecuteBlock(Lines: TStrings);
  62.   var
  63.     ddeC: TDDEClientConv;
  64.   begin
  65.     ddeC := TDDEClientConv.Create(nil);
  66.     if (ddeC.SetLink('VIRC', 'command')) then
  67.        ddeC.PokeDataLines('IRC_Command', Lines);
  68.     ddeC.Free;
  69.   end;
  70.  
  71. Evaluating text
  72. ---------------
  73.  
  74. Open a connection to the service "ViRC" and the topic "DDE". Send the text you
  75. wish to parse as a macro, then read the item "IRC_ParseVars" to get the result.
  76.  
  77. Visual Basic:
  78.   txDDE.LinkTopic = "ViRC|DDE"
  79.   txDDE.LinkItem = "IRC_ParseVars"
  80.   txDDE.LinkMode = 1
  81.   txDDE.LinkExecute "My nickname is $N."
  82.  
  83. Delphi:
  84.   function ViRC97_ParseString(x: string): string;
  85.   var
  86.     ddeC: TDDEClientConv;
  87.     ddeI: TDDEClientItem;
  88.   begin
  89.     ddeC := TDDEClientConv.Create(nil);
  90.     ddeI := TDDEClientItem.Create(nil);
  91.     ddeI.DDEConv := ddeC;
  92.     if (ddeC.SetLink('ViRC', 'DDE')) then
  93.     begin
  94.       ddeI.DdeItem := 'IRC_ParseVars';
  95.       ddeC.ExecuteMacro(PChar(x), False);
  96.       Result := ddeI.Text;
  97.     end;
  98.     ddeC.Free;
  99.     ddeI.Free;
  100.   end;
  101.